//
//  NoticeCell.m
//  BiuDejie
//
//  Created by dale on 2017/3/22.
//  Copyright © 2017年 dale. All rights reserved.
//

#import "NoticeCell.h"

@implementation NoticeCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self=[super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self setupView];
}
    return self;
}


-(void)setupView{
    
    //init
    self.noticeIcon=[[UIImageView alloc] init];
    [self.contentView addSubview:self.noticeIcon];
    //init
    self.noticeText=[[UILabel alloc] init];
    [self.contentView addSubview:self.noticeText];

   
    
    //frameSet
    self.noticeIcon.sd_layout.leftSpaceToView(self.contentView,10).heightIs(20).widthIs(20);
    
    
    self.noticeText.sd_layout.topSpaceToView(self.contentView,10).leftSpaceToView(self.noticeIcon,10).rightSpaceToView(self.contentView,10).autoHeightRatio(0);
    
    self.noticeText.numberOfLines=0;//设置自动换行
    self.noticeText.font=[UIFont systemFontOfSize:15];

}

-(void)setModel:(NoticeModel *)model{
    
    self.noticeIcon.image=[UIImage imageNamed:@"activity_date"];
    self.noticeText.text=model.jpushContext;
    self.type=model.type;

    self.notice_id=model.notice_id;

    self.noticeIcon.sd_layout.centerYEqualToView(self.contentView);

    [self setupAutoHeightWithBottomView:self.noticeText bottomMargin:5];


}

@end
